<?php
/**
 *
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/11/27
 * @copyright PanxSoft Inc.
 */

namespace App\Models\Location;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * 省 / 州
 *
 * @property string name
 *
 * @mixin Builder
 */
class Zone extends Model
{
    const ZONE_STATUS_ON = 1;
    const ZONE_TYPE = 'zone';
    const ZONE_ID_DEFAULT = 0;

    protected $guarded = [];

    protected $table = 'zone';

    protected $primaryKey = 'zone_id';

    public $appends = ['value'];

    /**
     * @return null
     */
    public function getValueAttribute()
    {
        if ($this->attributes['zone_id']) {
            return $this->attributes['zone_id'];
        } else {
            return null;
        }
    }
}